﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TimKen.App;
using System.Threading;
using System.Globalization;


namespace TimKen.Web.Admin
{
    public partial class Top :WebPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ibCh_Click(object sender, ImageClickEventArgs e)
        {
            SetLanguage("zh-CN");
            
        }

        protected void ibEn_Click(object sender, ImageClickEventArgs e)
        {
            SetLanguage("en-US");
        }


        private void SetLanguage(string language)
        {                                                                                                       
            Session.Add("lan", language);
            HttpCookie cookie = new HttpCookie("Language");
            DateTime dt = DateTime.Now;//定义时间对象
            TimeSpan ts = new TimeSpan(0, 20, 0);
            cookie.Expires.Add(ts);
            cookie.Value = language;
            HttpContext.Current.Response.AppendCookie(cookie);
            CultureInfo culture = new CultureInfo(language);
            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;
            //Server.Transfer("/Admin/Main.aspx");
           // Response.Redirect("/Admin/Main.aspx");
          Response.Write("<script>window.top.location=window.top.location;</script>");
        }
    }
}
